% the number of the usecase, use HSRxDefUseCase to assign a number to a usecase
\newcounter{HSRxUseCase}

%define a usecase with a number, no text is placed only a label
%params: number, labelname
\newcommand{\HSRxDefUseCase}[3]{
	\setcounter{HSRxUseCase}{#1-1}\refstepcounter{HSRxUseCase} \label{uc:#2}
	\expandafter\newcommand\expandafter{\csname #2\endcsname}{
		UC #1: #3
	}
}

\newcommand{\HSRxUCRefShort}[1]{
	UC \ref{#1}
}

\newcommand{\HSRxUCStepRef}[1]{
	Step \ref{#1}
}

%refernce a usecase UC__ from a label
%params: labelname
\newcommand{\HSRxRefUseCase}[2]{
%	\setlength\parskip{3mm} 
	\HSRxUCRefShort{#1}: #2
	\nopagebreak
}

%add a text block like Pre or Postcondition, the way larman's using it (template [Larman, 2009] Page 106)
\newcommand{\HSRxUseCasePar}[1]{
	%\setlength{\parskip}{3mm} 
	\paragraph{#1}
}

%add only a title without a text see HSRxUseCaseText
\newcommand{\HSRxUseCaseTitle}[1]{
	\setlength{\parskip}{3mm} 
	\paragraph{#1}$~~$\\
	\nopagebreak
}

%begin a stakeholders list
\newenvironment{HSRxUseCaseItemize}{
	\begin{itemize}\parskip0pt
}{
	\end{itemize}
}

%add a stakeholder to a stakeholderslist (\HSRxUseCaseStakeHolder}{Kunde}Will wissen bla bla bla...
\newcommand{\HSRxUseCaseStakeHolder}[1]{
	\item{#1}
}

% the counter used to differenciate the alternativs and extensions
\newcounter{HSRxUseCaseSeq}[subsubsection]

\newcounter{HSRxUseCaseStep}[HSRxUseCaseSeq]

\renewcommand{\theHSRxUseCaseStep}{
	\arabic{HSRxUseCaseStep}
}

%declare a system intention in a usecase sequence and set a label to reference its stepping number
%params labelname, text
\newcommand{\HSRxUseCaseDefSystem}[2]{
	\refstepcounter{HSRxUseCaseStep}\label{#1}
	\item[\small{[\arabic{HSRxUseCaseStep}] System:}]{#2}
}

%declare a user intention in a usecase sequence and set a label to reference its stepping number
%params labelname, text
\newcommand{\HSRxUseCaseDefUser}[2]{
	\refstepcounter{HSRxUseCaseStep}\label{#1}
	\item[\small{[\arabic{HSRxUseCaseStep}] User:}]{#2}
}

\newcommand{\HSRxUseCaseSystem}[1]{
	\stepcounter{HSRxUseCaseStep}
	\item[\small{[\arabic{HSRxUseCaseStep}] System:}]{#1}
}
\newcommand{\HSRxUseCaseUser}[1]{
	\stepcounter{HSRxUseCaseStep}
	\item[\small{[\arabic{HSRxUseCaseStep}] User:}]{#1}
}

%define a default sequence
\newenvironment{HSRxUseCaseDefSeq}{
	\begin{HSRxUseCaseSeq}
}{
	\end{HSRxUseCaseSeq}
}

\newenvironment{HSRxUseCaseSeq}{
	\setcounter{HSRxUseCaseStep}{0}
	%\setlength\parskip{3mm} 
	\begin{description}
	  \setlength{\topsep}{0pt}
	  \setlength{\parskip}{0pt}
	  \setlength{\partopsep}{0pt}
	  \setlength{\parsep}{0pt}         
}{
	\end{description}
}

%define a extension sequence with a referenc to a defined step
%params: step name, sequence name
\newenvironment{HSRxUseCaseExtSeqRef}[2]{
	\stepcounter{HSRxUseCaseSeq}
	%\setlength\parskip{3mm} 
	\paragraph{\ref{#1}\alph{HSRxUseCaseSeq}:} #2
	\begin{HSRxUseCaseSeq}
}{
	\end{HSRxUseCaseSeq}
}

%define a extension sequence without a referenc to a defined step
%params: the symbol (*), sequence name
\newenvironment{HSRxUseCaseExtSeq}[2]{
	\stepcounter{HSRxUseCaseSeq}
	%\setlength\parskip{3mm} 
	\paragraph{#1\alph{HSRxUseCaseSeq}:} #2
	\begin{HSRxUseCaseSeq}
}{
	\end{HSRxUseCaseSeq}
}